import {View, Text, StyleSheet, Button} from 'react-native';
import React from 'react';
import {useNavigation} from '@react-navigation/native';

export default function My({route}) {
  const navigation = useNavigation();
  const {params} = route;
  console.log('params2', params);

  return (
    <View style={styles.container}>
      <Text>My</Text>
      <Button
        onPress={() => navigation.popTo('Detail', {name: '从 my 回去的'})}
        // onPress={() => navigation.goBack()}
        title="返回至 detail"
      />
      <Button onPress={() => navigation.popToTop()} title="返回至 home" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});
